﻿using System.Linq;
using System.Web;
using System.Web.Routing;

namespace WebDiagnostics.Diagnosers.Routing
{
    [DiagnoserDescriptor("Registered Routes", Width = RenderWidth.Full)]
    public class RouteDiagnoser : IDiagnoser
    {
        public Diagnosis Diagnose(HttpContextBase context)
        {
            var routes = RouteTable.Routes.Cast<Route>().ToArray();

            return new RouteDiagnosis { Routes = routes };
        }
    }
}
